package com.sree.tali.dao.homepage.impl;

import com.sree.tali.pojo.AdminHomepojo;
import com.sree.tali.pojo.HomeList;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.Statement;
import java.util.ArrayList;
import java.util.List;
import org.hibernate.Query;
import org.hibernate.Session;
import org.hibernate.internal.SessionImpl;

public class IndexDao
  implements IIndexDao
{
  public List<HomeList> Load24List(Session paramSession)
  {
    return loadHomeTitles("24hrs", paramSession);
  }
  
  public List<HomeList> Load70List(Session paramSession)
  {
    return loadHomeTitles("70mm", paramSession);
  }
  
  public List<HomeList> AtoZList(Session paramSession)
  {
    return loadHomeTitles("AtoZ", paramSession);
  }
  
  public List<HomeList> loadHomeTitles(String paramString, Session paramSession)
  {
    ArrayList localArrayList = new ArrayList();
    HomeList localHomeList = null;
    try
    {
      Connection localConnection = ((SessionImpl)paramSession).connection();
      String str = "select id ,UPLOAD_TYPE, TITLE from upload_home where UPLOAD_TYPE ='" + paramString + "' order by id DESC";
      Statement localStatement = localConnection.createStatement();
      ResultSet localResultSet = localStatement.executeQuery(str);
      while (localResultSet.next())
      {
        localHomeList = new HomeList();
        localHomeList.setId(localResultSet.getInt(1));
        localHomeList.setTypr(localResultSet.getString(2));
        localHomeList.setTitle(localResultSet.getString(3));
        localArrayList.add(localHomeList);
      }
    }
    catch (Exception localException)
    {
      localException.printStackTrace();
    }
    return localArrayList;
  }
  
  public AdminHomepojo DisplayPage(Session paramSession, int paramInt)
  {
    AdminHomepojo localAdminHomepojo = null;
    try
    {
      String str = "from AdminHomepojo pojo  where pojo.id=" + paramInt;
      Query localQuery = paramSession.createQuery(str);
      List localList = localQuery.list();
      localAdminHomepojo = (AdminHomepojo)localList.get(0);
    }
    catch (Exception localException)
    {
      localException.printStackTrace();
    }
    finally
    {
      if (paramSession != null) {
        paramSession.close();
      }
    }
    return localAdminHomepojo;
  }
}


/* Location:           D:\sreenu\talivud-new-110514\talivud-new\dist\WEB-INF\classes\
 * Qualified Name:     com.sree.tali.dao.homepage.impl.IndexDao
 * JD-Core Version:    0.7.0.1
 */